package cn.lizemin.controller;

import cn.lizemin.entity.User;
import cn.lizemin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lzm
 * @version 1.0
 * @description: TODO
 * @date 2021/12/26 18:06
 */
@RestController
public class UserController {

    private UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("users")
    public List<User> findAll() {
        return userService.findAll();
    }

    @GetMapping("save")
    public void save(User user) {
        userService.save(user);
    }

}
